Xen and tools now require gcc 3.4+ on x86.
authorKeir Fraser <keir@xensource.com>
Sat, 17 Mar 2007 12:04:48 +0000 (12:04 +0000)
committerKeir Fraser <keir@xensource.com>
Sat, 17 Mar 2007 12:04:48 +0000 (12:04 +0000)
 - gcc-3.2 cannot handle some multi-line assertions in the Xen
 sources. Noone noticed.
 - gcc-3.3 has problems with alignment constraints inside typedefs.

gcc 3.4.0 is now three years old so I hope that everyone has an
up-to-date compiler, or can obtain a more up-to-date package for their
distribution. If not we may need to fall back to supporting gcc-3.3.x
as well.

Also clean up the way we do version checks, using the power of awk.

Signed-off-by: Keir Fraser <keir@xensource.com>
Config.mk
tools/Rules.mk
xen/arch/x86/Rules.mk
xen/common/perfc.c
xen/include/public/arch-x86/xen-x86_32.h

index 6f9f970fe645edff3be6c65c6bfbb831a4a31432..0181cc3ad12c8890acea471a732aab8b87176444 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -36,6 +36,12 @@ endif
 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
               /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
 
+# cc-ver
+# Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
+cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
+           '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
+           then echo y; else echo n; fi ;)
+
 ifneq ($(debug),y)
 CFLAGS += -DNDEBUG
 else
index df3b231a1a84673c1a97000b2197af8ecab8c3da..3e13eceb553a22824929b839ed4abb664786ac4e 100644 (file)
@@ -23,6 +23,11 @@ LDFLAGS += $(shell getconf LFS_LDFLAGS)
 CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs)
 CFLAGS += $(CFLAGS-y)
 
+# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
+ifeq ($(CONFIG_X86)$(call cc-ver,$(CC),0x030400),yn)
+$(error Xen tools require at least gcc-3.4)
+endif
+
 %.opic: %.c
        $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) -fPIC -c -o $@ $<
 
index 899f28129c0b66ee036f52e20925a5166719e42b..86b9f33ab191fd93ddaf87bb6462c4a4387b7708 100644 (file)
@@ -58,19 +58,7 @@ HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/*.h)
 HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/svm/*.h)
 HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h)
 
-# Test for at least GCC v3.2.x.
-gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/')
-ifeq ($(call gcc-ver,1),1)
-$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,1),2)
-$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,1),3)
-ifeq ($(call gcc-ver,2),0)
-$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x)
-endif
-ifeq ($(call gcc-ver,2),1)
-$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x)
-endif
+# Require GCC v3.4+ (to avoid issues with alignment constraints in Xen headers)
+ifneq ($(call cc-ver,$(CC),0x030400),y)
+$(error Xen requires at least gcc-3.4)
 endif
index d5bcd9b2e1d983e66bfd1cbeacc2ffe2ba3b238b..bbff5d7b5ca1ecdf3a33ee41b8dedca77a454bab 100644 (file)
@@ -136,8 +136,8 @@ static xen_sysctl_perfc_desc_t perfc_d[NR_PERFCTRS];
 static xen_sysctl_perfc_val_t *perfc_vals;
 static int               perfc_nbr_vals;
 static int               perfc_init = 0;
-static int perfc_copy_info(XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc,
-                           XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t) val)
+static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc,
+                           XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val)
 {
     unsigned int i, j;
     unsigned int v = 0;
@@ -217,29 +217,20 @@ static int perfc_copy_info(XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc,
 int perfc_control(xen_sysctl_perfc_op_t *pc)
 {
     static DEFINE_SPINLOCK(lock);
-    XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc;
-    XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t) val;
     int rc;
 
-    /*
-     * 64 bit guest handles cannot be passed as parameters to
-     * functions so cast to a regular guest handle.
-     */
-    desc = guest_handle_cast(pc->desc, xen_sysctl_perfc_desc_t);
-    val = guest_handle_cast(pc->val, xen_sysctl_perfc_val_t);
-
     spin_lock(&lock);
 
     switch ( pc->cmd )
     {
     case XEN_SYSCTL_PERFCOP_reset:
-        perfc_copy_info(desc, val);
+        perfc_copy_info(pc->desc, pc->val);
         perfc_reset(0);
         rc = 0;
         break;
 
     case XEN_SYSCTL_PERFCOP_query:
-        perfc_copy_info(desc, val);
+        perfc_copy_info(pc->desc, pc->val);
         rc = 0;
         break;
 
index 2633ff082fe1b367f07a16dddaa202b51270d0f7..6728b818cde3f49bfebb26f9149304977e2daeba 100644 (file)
          (hnd).p = val;                                     \
     } while ( 0 )
 #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
-#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name __attribute__((aligned(8)))
+#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
 #endif
 
 #ifndef __ASSEMBLY__